﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace HealthHelper
{
    public partial class FrmScreen : Form
    {
        public FrmScreen()
        {
            InitializeComponent();
        }
        //地址 https://www.bbsmax.com/A/o75NEBvNJW/
        /*电脑动漫图片：http://api.btstu.cn/sjbz/?lx=dongman

        电脑美女图片：http://api.btstu.cn/sjbz/?lx=meizi

        电脑随机动漫妹子：http://api.btstu.cn/sjbz/?lx=suiji

        手机动漫图片：http://api.btstu.cn/sjbz/?lx=m_dongman

        手机美女图片：http://api.btstu.cn/sjbz/?lx=m_meizi

        手机随机动漫妹子：http://api.btstu.cn/sjbz/?m_lx=suiji
        */

        private List<string> urlList = new List<string>() { "http://api.btstu.cn/sjbz/?lx=dongman", "http://api.btstu.cn/sjbz/?lx=meizi", "http://api.btstu.cn/sjbz/?lx=suiji" };

        private void FrmScreen_Load(object sender, EventArgs e)
        {
            Task.Factory.StartNew(() =>
            {
                long index = DateTime.Now.Ticks % urlList.Count;

                try
                {
                    Image img = Image.FromStream(System.Net.WebRequest.Create(urlList[(int)index]).GetResponse().GetResponseStream());
                    this.Invoke(new Action(() => { BackgroundImage = img; }));
                }
                catch (Exception ex)
                {
                    // 吞了不管他
                    Console.WriteLine(ex);
                }

            });
        }
    }
}
